package com.wzdigit.wms.basic.enums;
import java.util.*;

/**
 * 车型
 */
public enum VehicleTypeEnum implements BaseEnum {

	CONTAINER_CAR(5000144, "集装箱车", "VehicleType"),
	COVERED_WAGON(5000145, "棚车", "VehicleType"),
	TRAILER(5010314, "14.5米飞翼挂车", "VehicleType");

    /**
     * 枚举值
     */
    public Integer code;

    /**
     * 枚举名称
     */
    public String enumName;

    /**
     * 枚举实体类属性描述
     */
    public String description;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
    
    public String getEnumName() {
        return enumName;
    }

    public void setEnumName(String enumName) {
        this.enumName = enumName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
    
    VehicleTypeEnum(String enumName, String description) {
        this.enumName = enumName;
        this.description = description;
    }

    VehicleTypeEnum(Integer code, String enumName, String description) {
        this.code = code;
        this.enumName = enumName;
        this.description = description;
    }

    public static VehicleTypeEnum getEnumByCode(String enumCode) {
        VehicleTypeEnum[] values = VehicleTypeEnum.values();
        VehicleTypeEnum samplingEnum = null;

        for (VehicleTypeEnum value : values) {
            if (value.getCode().equals(enumCode)) {
                samplingEnum = value;
                break;
            }
        }
        return samplingEnum;
    }

    public static VehicleTypeEnum getEnumByName(String enumName) {
        VehicleTypeEnum[] values = VehicleTypeEnum.values();
        VehicleTypeEnum repairEnum = null;

        for (VehicleTypeEnum value : values) {
            if (value.getEnumName() == enumName) {
                repairEnum = value;
            }
        }
        return repairEnum;
    }

    public static Integer getCodeByEnumNameAndDescription(String enumName, String enumDescription) {
        VehicleTypeEnum[] values = VehicleTypeEnum.values();
        for (VehicleTypeEnum value : values) {
            if (Objects.equals(value.getDescription(), enumDescription)
                    && Objects.equals(value.getEnumName(), enumName)) {
                return value.getCode();
            }
        }
        return null;
    }
    
    public static Map<Integer, String> getEnumByDescription() {
        Map<Integer, String> enumMap = new HashMap<Integer, String>();
        VehicleTypeEnum[] values = VehicleTypeEnum.values();
        for (VehicleTypeEnum value : values) {
        	enumMap.put(value.getCode(), value.getEnumName());
        }
        return enumMap;
    }

    public static Map<Integer, String> getEnumByDescription(String enumDescription) {
        Map<Integer, String> enumMap = new HashMap<Integer, String>();
        VehicleTypeEnum[] values = VehicleTypeEnum.values();
        for (VehicleTypeEnum value : values) {
            if (Objects.equals(value.getDescription(), enumDescription)) {
                enumMap.put(value.getCode(), value.getEnumName());
            }
        }
        return enumMap;
    }

    public static List<Map<String, Object>> getEnumListByDescription(String enumDescription) {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        VehicleTypeEnum[] values = VehicleTypeEnum.values();
        for (VehicleTypeEnum value : values) {
            if (Objects.equals(value.getDescription(), enumDescription)) {
                Map<String, Object> enumMap = new HashMap<String, Object>(2);
                enumMap.put("code", value.getCode());
                enumMap.put("name", value.getEnumName());
                list.add(enumMap);
            }
        }
        return list;
    }
}
